/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cl.zeke.pizzastore.negocio.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author taller
 */
@Entity
@Table(name = "CATEGORIA_PIZZA")
@NamedQueries({
    @NamedQuery(name = "CategoriaPizza.findAll", query = "SELECT c FROM CategoriaPizza c"),
    @NamedQuery(name = "CategoriaPizza.findByIdCategoriaPizza", query = "SELECT c FROM CategoriaPizza c WHERE c.idCategoriaPizza = :idCategoriaPizza"),
    @NamedQuery(name = "CategoriaPizza.findByNombre", query = "SELECT c FROM CategoriaPizza c WHERE c.nombre = :nombre")})
public class CategoriaPizza implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_CATEGORIA_PIZZA")
    private Long idCategoriaPizza;
    @Basic(optional = false)
    @Column(name = "NOMBRE")
    private String nombre;
    @OneToMany(mappedBy = "idCategoriaPizza", fetch = FetchType.LAZY)
    private List<Pizza> pizzaList;

    public CategoriaPizza() {
    }

    public CategoriaPizza(Long idCategoriaPizza) {
        this.idCategoriaPizza = idCategoriaPizza;
    }

    public CategoriaPizza(Long idCategoriaPizza, String nombre) {
        this.idCategoriaPizza = idCategoriaPizza;
        this.nombre = nombre;
    }

    public Long getIdCategoriaPizza() {
        return idCategoriaPizza;
    }

    public void setIdCategoriaPizza(Long idCategoriaPizza) {
        this.idCategoriaPizza = idCategoriaPizza;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public List<Pizza> getPizzaList() {
        return pizzaList;
    }

    public void setPizzaList(List<Pizza> pizzaList) {
        this.pizzaList = pizzaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategoriaPizza != null ? idCategoriaPizza.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoriaPizza)) {
            return false;
        }
        CategoriaPizza other = (CategoriaPizza) object;
        if ((this.idCategoriaPizza == null && other.idCategoriaPizza != null) || (this.idCategoriaPizza != null && !this.idCategoriaPizza.equals(other.idCategoriaPizza))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.zeke.pizzastore.negocio.entities.CategoriaPizza[ idCategoriaPizza=" + idCategoriaPizza + " ]";
    }
    
}
